package tech.dx.springdb.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tech.dx.springdb.entity.CourseInfo;
import tech.dx.springdb.service.CourseInfoService;

/**
 * @ClassName CourseInfoController
 * @Description TODO
 * @Author omg
 * @Date 2019/4/5 14:50
 * @Version 1.0
 */
@RestController
@RequestMapping("courseinfo")
@Api(tags = {"课程信息"})
public class CourseInfoController {

    @Autowired
    private CourseInfoService courseInfoService;

    @PostMapping
    public CourseInfo add(@RequestBody CourseInfo courseInfo) {
        return courseInfoService.add(courseInfo);
    }

    @PutMapping
    public CourseInfo update(@RequestBody CourseInfo courseInfo) {
        return courseInfoService.update(courseInfo);
    }

    @GetMapping("/{id}")
    public CourseInfo get(@PathVariable long id) {
        return courseInfoService.getById(id);
    }
}
